package com.nbsaas.boot.merchant.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "商家分类", model = "商家分类")
@Entity
@Table(name = "bs_merchant_category")
@Comment("商家分类表")
public class MerchantCategory extends AbstractEntity {

    @Comment("分类名称")
    @SearchItem(name = "name", key = "name", label = "分类名称")
    @FormField(title = "分类名称", sortNum = "1", grid = true, required = true)
    @Column(length = 100, nullable = false)
    private String name;

    @Comment("分类编码")
    @SearchItem(name = "code", key = "code", label = "分类编码")
    @FormField(title = "分类编码", sortNum = "2", grid = true)
    @Column(length = 50, unique = true)
    private String code;

    @Comment("父分类ID")
    @FormField(title = "父分类", sortNum = "3", type = InputType.select)
    private Long parentId;

    @Comment("分类层级")
    @FormField(title = "分类层级", sortNum = "4", type = InputType.el_input_number)
    private Integer level;

    @Comment("分类路径")
    @FormField(title = "分类路径", sortNum = "5")
    @Column(length = 500)
    private String path;

    @Comment("分类图标")
    @FormField(title = "分类图标", sortNum = "6", type = InputType.image)
    @Column(length = 500)
    private String icon;

    @Comment("分类图片")
    @FormField(title = "分类图片", sortNum = "7", type = InputType.image)
    @Column(length = 500)
    private String image;

    @Comment("分类描述")
    @FormField(title = "分类描述", sortNum = "8", type = InputType.textarea)
    @Column(length = 1000)
    private String description;

    @Comment("排序")
    @FormField(title = "排序", sortNum = "9", type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("是否启用")
    @FormField(title = "是否启用", sortNum = "10", grid = true)
    private Boolean enabled;

    @Comment("是否显示")
    @FormField(title = "是否显示", sortNum = "11", grid = true)
    private Boolean visible;

    @Comment("佣金比例")
    @FormField(title = "佣金比例", sortNum = "12", type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal commissionRate;

    @Comment("保证金金额")
    @FormField(title = "保证金金额", sortNum = "13", type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal depositAmount;
} 